using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline.Processors;


namespace Mundo_3D
{
    class Mundo_Basico
    {
        public Model model { get; protected set; }
        protected Matrix world = Matrix.Identity;

        public Mundo_Basico(Model m)
        {
            model = m;
        }

        public virtual void Update()
        {
        }

        public void Draw(Camara_Basica camera)
        {
            Matrix[] transforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(transforms);
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect be in mesh.Effects)
                {
                    be.EnableDefaultLighting();
                    be.Projection = camera.projection;
                    be.View = camera.view;
                    be.World = GetWorld() * mesh.ParentBone.Transform;
                    be.SpecularColor = new Vector3(0.6f, 0.4f, 0.2f);
                    be.SpecularPower = 7;
                    be.FogEnabled = true;
                    be.FogColor = new Vector3(0.15f);
                    be.FogStart = 3000;
                    be.FogEnd = 5000;
                }
                mesh.Draw();
            }
        }

        public virtual Matrix GetWorld()
        {
            return world;
        }
    }
}